//
// Created by hunan on 24-8-19.
//
#include <file_handle.h>
#include <gtest/gtest.h>
#include <string>
#include <write_read_module/buffer.h>

TEST(FileHandleWriteData, Test)
{
    std::string filename = "./test001.ts";
    WriteBuffer buffer;
    for (int index = 0; index < 100000; index++)
    {
        uint8_t data = rand() % 20 + 'a';
        buffer.WriteUint8(data);
    }
    FileHandle file_handle(filename);
    int result  = file_handle.OpenFileReadWrite();
    if (result >= 0)
    {
        printf("write data.\n");
        file_handle.Write(buffer.BufferData(), buffer.BufferDataSize());
    }
}